package com.weyoung.app.controller;

import com.weyoung.app.service.CozeService;
import com.weyoung.common.consatant.result.Result;
import com.weyoung.common.model.dto.app.CozeAnalyzeDTO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@Tag(name = "模型调用-工作流")
@RestController
@RequestMapping("/api/coze")
@RequiredArgsConstructor
@Validated
public class CozeController {

    private final CozeService cozeService;

    @PostMapping("/analyze")
    @Operation(summary = "调用扣子工作流图生视频-创建任务")
    public Result<Map<String,String>> analyzeContent(@RequestBody @Validated CozeAnalyzeDTO dto) {
        Map<String,String> chat = cozeService.analyzeContent(dto);
        return Result.success(chat);
    }

    /**
     * 获取图生成的视频地址
     */
    @GetMapping("/videoUrl")
    @Operation(summary = "获取图生成的视频地址")
    public Result<Map<String, String>> getVideoUrl() {
        Map<String, String> videoUrl = cozeService.getVideoUrl();
        return Result.success(videoUrl);
    }

}